<template>
    <div>
        <jsscom-heard />
        <div class="cons">
            <div class="pu-con pc-0">
                <p>当前位置：中国广告协会 > 国家广告产业园</p>
            </div>
            <div class="pc-1 pu-con">
                <div class="pc-left">
                    <div class="pc-con" v-if="newsList.length>0">
                        <router-link
                            :to="{path:'/gxzd/gglist/dec',query:{data:JSON.stringify(item) }}"
                            v-for="(item,index) in newsList "
                            :key="index"
                        >
                            <img :src="prefixUrl+item.imgUrl1" alt />
                            <div>
                                <h1>{{item.title}}</h1>
                                <p>租赁方式：{{item.rentType}}</p>
                                <p>房屋配套：{{item.houseConfig}}</p>
                                <p>所在区域：{{item.localArea}}</p>
                                <span>
                                    <p>
                                        <!-- <img src="../../../assets/g-21.png" alt />
                                        <strong>1902</strong>-->
                                    </p>
                                    <p>
                                        <img src="../../../assets/g-20.png" alt />
                                        <strong>咨询热线</strong>
                                        <strong>{{item.phone}}</strong>
                                    </p>
                                </span>
                            </div>
                        </router-link>
                    </div>
                    <div class="pc-con" v-else>
                        <p>暂无数据</p>
                    </div>
                    <div class="news-page">
                        <el-pagination
                            background
                            layout="prev, pager, next"
                            :total="totalSum"
                            :page-size="sizeSum"
                            @size-change="handleSizeChange"
                            @current-change="handleCurrentChange"
                        ></el-pagination>
                    </div>
                </div>
                <div class="pc-right">
                    <h1>商家推荐</h1>
                    <div class="pcr-con" v-if="sjtjList.length>0">
                        <router-link
                            :to="{path:'/gxzd/huwai/dec',query:{data:JSON.stringify(item) }}"
                            v-for="(item,index) in sjtjList.slice(0,3)"
                            :key="index"
                        >
                            <img :src="prefixUrl+item.img1.split(',')[0]" alt />
                            <h2>{{item.title}}</h2>
                            <p>{{item.area.match(/-(\S*)-(\S*)/)[1]}}/ {{item.mediaName}}</p>
                        </router-link>
                    </div>
                    <div class="pcr-con" v-else>
                        <p>暂无数据</p>
                    </div>
                </div>
            </div>
            <div style="height:25px"></div>
            <div class="pu-con pc-5">
                <router-link to>
                    <img src="../../../assets/g-10.png" alt />
                </router-link>
            </div>
        </div>
        <com-foot></com-foot>
    </div>
</template>

<script>
import jsscomHeard from '@/components/gxzd-heard'
import comFoot from '@/components/com-foot'

export default {
    components: {
        jsscomHeard,
        comFoot
    },
    filters: {
        pattime(value) {
            return value.slice(0, 10)
        }
    },
    data() {
        return {
            prefixUrl: '',
            totalSum: 0,
            sizeSum: 10,
            newsList: [],
            sjtjList: []
        }
    },
    created() {
        this.prefixUrl = this.$store.state.user.imgUrl
        this.getPageAdPark(1)
        this.getToIndexListSj()
    },
    mounted() {

    },
    methods: {
        async getToIndexListSj() {
            const res = await this.$store.dispatch('access/getToIndexListSj')
            this.sjtjList = res
            console.log(res)
        },
        async getPageAdPark(curIndex) {
            const data = { currentPage: curIndex, pageSize: 10 }
            const res = await this.$store.dispatch('access/getPageAdPark', data)
            this.totalSum = res.totalCount
            this.newsList = res.list
        },
        uncultivated() {
            this.$message({
                message: '功能暂未开放，敬请期待',
                type: 'warning'
            });
        },
        handleSizeChange(val) {
            console.log(`每页 ${val} 条`);
        },
        handleCurrentChange(val) {
            this.getPageAdPark(val)
        },
    }
}
</script>

<style scoped>
@import "./gglist.css";
</style>
